{template '_header'}
<style type="text/css">
    .table_kf {display: none;}
    .table_kf.active {display: table-footer-group;}
</style>
<div class="page-heading">
    <span class='pull-right'>
        {ifp 'sale.coupon'}
            {if $data['isopengoodssendtask']==1}
                <a class='btn btn-danger btn-sm' href="{php echo webUrl('sale/coupon/goodssend/closetask')}"><i class='fa fa-close'></i> 关闭功能</a>
            {else}
                <a class='btn btn-warning btn-sm' href="{php echo webUrl('sale/coupon/goodssend/opentask')}"><i class='fa fa-plus'></i> 开启功能</a>
            {/if}
            <a class='btn btn-primary btn-sm' href="{php echo webUrl('sale/coupon/goodssend/add')}"><i class='fa fa-plus'></i> 添加任务</a>
        {/if}
    </span>
    <h2><i class="fa fa-circle-o"></i>发送任务</h2> </div>
<ul class="nav nav-arrow-next nav-tabs" id="myTab">
    <li  >
        <a href="{php echo webUrl('sale/coupon/sendtask')}">满额送优惠券</a>
    </li>
    <li class="active">
        <a href="{php echo webUrl('sale/coupon/goodssend')}">购买指定商品送优惠券</a>
    </li>
</ul>
<form action="" method="post">
    <table class="table table-hover table-responsive">
        <thead class="navbar-inner">
        <tr>
            <th style="width: 70px">商品图片</th>
            <th style="width: 140px">商品信息</th>
            <th style="width: 70px">优惠券图片</th>
            <th style="width: 100px">优惠券名称</th>
            <th>赠送数量</th>
            <th  style="width: 190px">活动时间</th>
            <th>剩余数量</th>
            <th>状态</th>
            <th style="width:120px">操作</th>
        </tr>
        </thead>
        <tbody>
        {if count($goodssends)>0}
        {loop $goodssends $item}
        <tr>
            <td>
                <img src="{php echo tomedia($item['ghumb'])}" style="width:40px;height:40px;padding:1px;border:1px solid #ccc;"  />
            </td>
            <td>
                {$item['title']}
            </td>
            <td>
                <img src="{php echo tomedia($item['cthumb'])}" style="width:40px;height:40px;padding:1px;border:1px solid #ccc;"  />
            </td>
            <td>
                {$item['couponname']}
            </td>
            <td>
                {$item['sendnum']}
            </td>
            <td>
                {php echo date("Y-m-d ", $item['starttime'])} - {php echo date("Y-m-d", $item['endtime'])}
            </td>
            <td>
                {$item['num']}
            </td>
            <td>
                {if  $item['status']==1}开启{else}关闭{/if}
            </td>
            <td  style="overflow:visible;position:relative;text-align: right;">
                {ifp 'sale.coupon'}
                <a  class='btn btn-default btn-sm' href="{php echo webUrl('sale.coupon.goodssend/edit', array('id' => $item['id'],'page'=>$page))}" title="{ifp 'sale.coupon'}编辑{else}查看{/if}"><i class='fa fa-edit'></i> {ifp 'sale.coupon'}编辑{else}查看{/if}</a>
                {/if}
                {ifp 'sale.coupon'}
                <a  class='btn btn-default btn-sm' data-toggle='ajaxRemove' href="{php echo webUrl('sale.coupon.goodssend/delete', array('id' => $item['id']))}" data-confirm='确认要删除吗?？'><i class='fa fa-remove'></i> 删除</a>
                {/if}
            </td>
        </tr>
        {/loop}
        {else}
        <td colspan="6" style="text-align: center;">暂时没有任何任务!</td>
        {/if}
        </tbody>
    </table>
</form>
<div style="text-align:right;width:100%;">
    {$pager}
</div>
{template '_footer'}
